﻿using System;
using System.Windows.Forms;

namespace SimpleMediaPlayer
{
    public partial class GoToTime : Form
    {
        public double Position { get; internal set; }

        public GoToTime(double position, TimeSpan length)
        {
            InitializeComponent();

            this.Position = -1;

            dateTimePicker.MinDate = DateTime.Today;
            dateTimePicker.MaxDate = DateTime.Today + length;
            dateTimePicker.Value = DateTime.Today + TimeSpan.FromSeconds(position);
        }

        private void GoToTime_Load(object sender, EventArgs e)
        {

        }

        private void buttonGo_Click(object sender, EventArgs e)
        {
            this.Position = (dateTimePicker.Value.Ticks / TimeSpan.TicksPerSecond) - (DateTime.Today.Ticks / TimeSpan.TicksPerSecond);

            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
